package jgl.vajra.kingkong.manager;

import android.os.Bundle;

import androidx.fragment.app.FragmentActivity;

import jgl.vajra.kingkong.bean.AdditionalRequirementsBean;
import jgl.vajra.kingkong.bean.VersionUpdateBean;
import jgl.vajra.kingkong.listener.MessageDlialogListener;
import jgl.vajra.kingkong.part.home.fragment.HomePageFragment;
import jgl.vajra.kingkong.part.home.fragment.HomeVehicleTypeFragment;
import jgl.vajra.kingkong.part.home.fragment.MinePageFragment;
import jgl.vajra.kingkong.part.home.fragment.OrderPageFragment;
import jgl.vajra.kingkong.part.home.fragment.OrderPageListFragment;
import jgl.vajra.kingkong.part.mine.fragment.CouponPageListFragment;
import jgl.vajra.kingkong.part.mine.fragment.MyTeamAllListFragment;
import jgl.vajra.kingkong.widget.dialogfragment.MessageDialogFragment;

public class FragmentManager {

    public static MessageDialogFragment getMessageDialogFragment(String messageContent, boolean isLeftCloseDialog,boolean isLeftHideDialog, boolean isRightCloseDialog, String leftText, String rightText, MessageDlialogListener listener) {
        MessageDialogFragment fragment = new MessageDialogFragment();
        fragment.setMessageConent(messageContent);
        fragment.setLeftCloseDialog(isLeftCloseDialog);
        fragment.setLeftHideDialog(isLeftHideDialog);
        fragment.setRightCloseDialog(isRightCloseDialog);
        fragment.setRightText(rightText);
        fragment.setLeftText(leftText);
        fragment.setMessageDialogListener(listener);
        return fragment;
    }

    public static MessageDialogFragment getMessageDialogFragment(String messageContent, MessageDlialogListener listener) {
        return getMessageDialogFragment(messageContent, true,false, true, "取消", "确认", listener);
    }

    public static MessageDialogFragment getMessageDialogFragment(String messageContent, String leftText, String rightText, MessageDlialogListener listener) {
        return getMessageDialogFragment(messageContent, true,false, true, leftText, rightText, listener);
    }

    public static MessageDialogFragment getMessageDialogFragment(String messageContent,boolean isLeftCloseDialog, String leftText, String rightText, MessageDlialogListener listener) {
        return getMessageDialogFragment(messageContent, isLeftCloseDialog, true,true, leftText, rightText, listener);
    }

    public static MessageDialogFragment getMessageDialogAdditional(AdditionalRequirementsBean itemData, MessageDlialogListener listener) {
        return getMessageDialogFragment(itemData.title, itemData.noNeedText, itemData.needText, listener);
    }

    public static MessageDialogFragment getMessageDialogCancelAccount(MessageDlialogListener listener) {
        return getMessageDialogFragment("注销后您的身份、账户信息、钱包余额、优惠券及单子信息都会被清空且无法找回", "我再想想", "确定注销", listener);
    }

    public static MessageDialogFragment getMessageDialogCancelOrderPrompt(MessageDlialogListener listener) {
        return getMessageDialogFragment("您的订单超时未支付，订单已取消，若需要继续用车请重新下单。", false,"", "我知道了", listener);
    }

    public static HomePageFragment getHomePageFragment() {
        HomePageFragment pageFragment = new HomePageFragment();
        return pageFragment;
    }

    public static OrderPageFragment getOrderPageFragment() {
        OrderPageFragment pageFragment = new OrderPageFragment();
        return pageFragment;
    }

    public static OrderPageListFragment getOrderPageListFragment(int type) {
        OrderPageListFragment pageFragment = new OrderPageListFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("type", type);
        pageFragment.setArguments(bundle);
        return pageFragment;
    }

    public static MinePageFragment getMinePageFragment() {
        MinePageFragment pageFragment = new MinePageFragment();
        return pageFragment;
    }

    public static HomeVehicleTypeFragment getHomeVehicleTypeFragment(int type, String name, String model, boolean isCalculator) {
        HomeVehicleTypeFragment pageFragment = new HomeVehicleTypeFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("type", type);
        bundle.putString("name", name);
        bundle.putString("model", model);
        bundle.putBoolean("isCalculator", isCalculator);
        pageFragment.setArguments(bundle);
        return pageFragment;
    }

    public static void getVersionUpdateDialogFragment(FragmentActivity activity, VersionUpdateBean versionUpdateBean) {
        UpdateApkDialogFragment updateApkDialogFragment =new UpdateApkDialogFragment();
        updateApkDialogFragment.initDialogConfig(versionUpdateBean,activity);
        updateApkDialogFragment.show(activity.getSupportFragmentManager());
    }

    public static MyTeamAllListFragment getMyTeamAllListFragment(int type) {
        MyTeamAllListFragment pageFragment = new MyTeamAllListFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("type", type);
        pageFragment.setArguments(bundle);
        return pageFragment;
    }

    public static CouponPageListFragment getCouponPageListFragment(int type) {
        CouponPageListFragment pageFragment = new CouponPageListFragment();
        Bundle bundle = new Bundle();
        bundle.putInt("type", type);
        pageFragment.setArguments(bundle);
        return pageFragment;
    }
}
